<template>
  <div>
    <el-button
      style="margin-bottom:10px"
      @click="()=>{$router.go(-1)}"
    >返回</el-button>
    <div class="content">
      <div class="cardLeft">
        <el-card>
          <el-form label-width="140px">
            <el-card>
              <el-form-item
                label-width="130px"
                label="现公司信息"
                style="background: #e1e1e1;"
              />
              <el-form-item
                label="公司行政区划："
                label-width="200px"
              ><span>{{companyData.primevaadministrativedivision}}</span> </el-form-item>
              <el-form-item
                label="公司品牌名称："
                label-width="200px"
              ><span>{{companyData.primevabelongbrandname}}</span> </el-form-item>
              <el-form-item
                label="品牌公司名称："
                label-width="200px"
              ><span>{{companyData.primevacompanyname}}</span> </el-form-item>
            </el-card>
          </el-form>
        </el-card>
      </div>
      <div class="cardRight">
        <el-card>
          <el-form label-width="200px">
            <el-card>
              <el-form-item
                label-width="180px"
                label="变更后公司信息"
                style="background: #e1e1e1;"
              />

              <el-form-item
                label="公司行政区划："
                label-width="200px"
              ><span>{{companyData.newadministrativedivision}}</span> </el-form-item>
              <el-form-item
                label="公司品牌名称："
                label-width="200px"
              ><span>{{companyData.newbelongbrandname}}</span> </el-form-item>
              <el-form-item
                label="品牌公司名称："
                label-width="200px"
              ><span>{{companyData.newcompanyname}}</span> </el-form-item>
            </el-card>
          </el-form>
        </el-card>
        
      </div>
    </div>

    <div class="next">
      <div class="nextLeft">
        <el-card>
          <el-form label-width="140px">
            <el-card>

              <el-form-item
                label-width="180px"
                label="品牌公司级别信息"
                style="background: #e1e1e1;"
              />

              <div style="padding:20px 0 ">
                <el-form-item
                  label="品牌公司级别："
                  label-width="200px"
                >
                  <span v-if="companyData.primevallevel==1">全球公司</span>
                  <span v-else-if="companyData.primevallevel==2">省级公司</span>
                  <span v-else-if="companyData.primevallevel==3">市级公司</span>
                  <span v-else-if="companyData.primevallevel==4">县级公司</span>
                </el-form-item>
                <el-form-item
                  label="品牌公司类型："
                  label-width="200px"
                >
                  <span v-if="companyData.primevacompanytype==0">孵化</span>
                  <span v-if="companyData.primevacompanytype==1">临时</span>
                  <span v-if="companyData.primevacompanytype==2">正式</span>
                </el-form-item>
              </div>
            </el-card>
          </el-form>
        </el-card>
      </div>
      <div class="nextRight">
        <el-card>
          <el-form label-width="140px">
            <el-card>
              <el-form-item
                label-width="240px"
                label="变更后品牌公司级别信息"
                style="background: #e1e1e1;"
              />

              <div style="padding:20px 0 ">
                <el-form-item
                  label="品牌公司级别："
                  label-width="200px"
                >
                  <span v-if="companyData.newlevel==1">全球公司</span>
                  <span v-else-if="companyData.newlevel==2">省级公司</span>
                  <span v-else-if="companyData.newlevel==3">市级公司</span>
                  <span v-else-if="companyData.newlevel==4">县级公司</span>
                </el-form-item>
                <el-form-item
                  label="品牌公司类型："
                  label-width="200px"
                >
                  <span v-if="companyData.newcompanytype==0">孵化</span>
                  <span v-if="companyData.newcompanytype==1">临时</span>
                  <span v-if="companyData.newcompanytype==2">正式</span>
                </el-form-item>
              </div>
            </el-card>
          </el-form>
        </el-card>
      </div>
    </div>

    <div class="foot">
      <div class="footLeft">
        <el-card>
          <el-form label-width="140px">
            <el-card>

              <el-form-item
                label-width="145px"
                label="开发关系信息 "
                style="background: #e1e1e1;"
              />
              <el-form-item
                label="上级品牌公司ID："
                label-width="200px"
              >
                <span>{{companyData.primevadeveloprelationid}}</span>

              </el-form-item>
              <el-form-item
                label="上级品牌公司级别："
                label-width="200px"
              >
                <span
                  v-if="companyData.primevadeveloprelationlevel == 1"
                  style="color: #4acf1e"
                >全球公司</span>
                <span
                  v-else-if="companyData.primevadeveloprelationlevel == 2"
                  style="color: #4acf1e"
                >省级公司</span>
                <span
                  v-else-if="companyData.primevadeveloprelationlevel == 3"
                  style="color: #4acf1e"
                >市级公司</span>
                <span
                  v-else-if="companyData.primevadeveloprelationlevel == 4"
                  style="color: #4acf1e"
                >县级公司</span>
              </el-form-item>
              <el-form-item
                label="上级品牌公司类型："
                label-width="200px"
              >
                <span v-if="companyData.primevadeveloprelationtype == '0'">孵化公司</span>
                <span v-else-if="companyData.primevadeveloprelationtype == '1'">临时公司</span>
                <span v-else-if="companyData.primevadeveloprelationtype == '2'">正式公司</span>
              </el-form-item>
              <el-form-item
                label="上级品牌公司名称："
                label-width="200px"
              >
                <span>{{companyData.primevadeveloprelationname}}</span>
              </el-form-item>

            </el-card>
          </el-form>
        </el-card>
      </div>
      <div class="footRight">
        <el-card>
          <el-form label-width="140px">
            <el-card>
              <el-form-item
                label-width="200px"
                label="变更后开发关系信息"
                style="background: #e1e1e1;"
              />

              <el-form-item
                label="上级品牌公司ID："
                label-width="200px"
              >
                <span>{{companyData.newdeveloprelationid}}</span>

              </el-form-item>
              <el-form-item
                label="上级品牌公司级别："
                label-width="200px"
              >
                <span
                  v-if="companyData.newdeveloprelationlevel == 1"
                  style="color: #4acf1e"
                >全球公司</span>
                <span
                  v-else-if="companyData.newdeveloprelationlevel == 2"
                  style="color: #4acf1e"
                >省级公司</span>
                <span
                  v-else-if="companyData.newdeveloprelationlevel == 3"
                  style="color: #4acf1e"
                >市级公司</span>
                <span
                  v-else-if="companyData.newdeveloprelationlevel == 4"
                  style="color: #4acf1e"
                >县级公司</span>
              </el-form-item>
              <el-form-item
                label="上级品牌公司类型："
                label-width="200px"
              >
                <span v-if="companyData.newdeveloprelationtype == '0'">孵化公司</span>
                <span v-else-if="companyData.newdeveloprelationtype == '1'">临时公司</span>
                <span v-else-if="companyData.newdeveloprelationtype == '2'">正式公司</span>
              </el-form-item>
              <el-form-item
                label="上级品牌公司名称："
                label-width="200px"
              >
                <span>{{companyData.newdeveloprelationname}}</span>
              </el-form-item>

            </el-card>
          </el-form>
        </el-card>
      </div>
    </div>

    <div class="end">
      <div class="endLeft">
        <el-card>
          <el-form label-width="140px">
            <el-card>
              <el-form-item
                label-width="55%"
                label="品牌公司组织结构设置"
                style="background: #e1e1e1;"
              />
              <el-form-item
                label="创始人信息："
                label-width="200px"
              >

                <el-table
                  border
                  :data="companyoriginator"
                  v-loading="loading"
                  :header-cell-style="getRowClass"
                >
                  <el-table-column
                    label="商城ID"
                    align="center"
                    prop="companyoriginatorid"
                  > </el-table-column>
                  <el-table-column
                    label="商城公司账号"
                    align="center"
                    prop="originatoraccount"
                  > </el-table-column>
                  <el-table-column
                    label="商城公司名称"
                    align="center"
                    prop="originatorcompanyname"
                  > </el-table-column>
                </el-table>

              </el-form-item>
              <el-form-item
                style="margin-top:20px"
                label="首席合伙人信息："
                label-width="200px"
              >
                <div class="oneInfo">
                  <div class="oneLeft">
                    <span>【原首席合伙人】</span>
                    <el-table
                      border
                      :data="primevaceo"
                      v-loading="loading"
                      :header-cell-style="getRowClass"
                      empty-text="无修改"
                    >
                      <el-table-column
                        label="商城ID"
                        align="center"
                        prop="primevaceoid"
                      > </el-table-column>
                      <el-table-column
                        label="合伙人类型"
                        align="center"
                        prop="primevaceotype"
                      >
                        <template slot-scope="scope">
                          <span
                            v-if="scope.row.primevaceotype==0"
                            style="color:#4acf1e;"
                          >孵化</span>
                          <span
                            v-else-if="scope.row.primevaceotype==1"
                            style="color:#4acf1e;"
                          >临时</span>
                          <span
                            v-else-if="scope.row.primevaceotype==2"
                            style="color:#4acf1e;"
                          >正式</span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        label="商城公司账号"
                        align="center"
                        prop="primevaceoaccount"
                      > </el-table-column>
                      <el-table-column
                        label="商城公司名称"
                        align="center"
                        prop="primevaceocompanyname"
                      > </el-table-column>
                    </el-table>
                  </div>
                  <div class="oneRight">
                    <span>【变更后首席合伙人】</span>
                    <el-table
                      border
                      :data="changePrimevaceo"
                      v-loading="loading"
                      :header-cell-style="getRowClass"
                      empty-text="无修改"
                    >
                      <el-table-column
                        label="商城ID"
                        align="center"
                        prop="primevaceoid"
                      > </el-table-column>
                      <el-table-column
                        label="合伙人类型"
                        align="center"
                        prop="primevaceotype"
                      >
                        <template slot-scope="scope">
                          <span
                            v-if="scope.row.primevaceotype==0"
                            style="color:#4acf1e;"
                          >孵化</span>
                          <span
                            v-else-if="scope.row.primevaceotype==1"
                            style="color:#4acf1e;"
                          >临时</span>
                          <span
                            v-else-if="scope.row.primevaceotype==2"
                            style="color:#4acf1e;"
                          >正式</span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        label="商城公司账号"
                        align="center"
                        prop="primevaceoaccount"
                      > </el-table-column>
                      <el-table-column
                        label="商城公司名称"
                        align="center"
                        prop="primevaceocompanyname"
                      > </el-table-column>
                    </el-table>
                  </div>
                </div>
              </el-form-item>
              <el-form-item
                style="margin-top:20px"
                label="高级合伙人信息："
                label-width="200px"
              >
                <div class="oneInfo">
                  <div class="oneLeft">
                    <span>【新增高级合伙人】</span>
                    <el-table
                      border
                      :data="companyData.addSeniorPartners"
                      v-loading="loading"
                      :header-cell-style="getRowClass"
                      height="250px"
                      empty-text="无修改"
                    >
                      <el-table-column
                        label="商城ID"
                        align="center"
                        prop="entityid"
                      > </el-table-column>
                      <el-table-column
                        label="合伙人类型"
                        align="center"
                        prop="partnertype"
                      >
                        <template slot-scope="scope">
                          <span
                            v-if="scope.row.partnertype==0"
                            style="color:#4acf1e;"
                          >孵化</span>
                          <span
                            v-else-if="scope.row.partnertype==1"
                            style="color:#4acf1e;"
                          >临时</span>
                          <span
                            v-else-if="scope.row.partnertype==2"
                            style="color:#4acf1e;"
                          >正式</span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        label="商城公司账号"
                        align="center"
                        prop="entityaccount"
                      > </el-table-column>
                      <el-table-column
                        label="商城公司名称"
                        align="center"
                        prop="entitycompanyname"
                      >
                        <template slot-scope="scope">
                          <span style="color:#4acf1e;">{{scope.row.entitycompanyname}}</span>

                        </template>
                      </el-table-column>
                      <el-table-column
                        label="操作"
                        align="center"
                      >
                        <template slot-scope="scope">
                          <el-button
                            type="danger"
                            size="mini"
                            @click="deleteHighPartner(scope.row)"
                          >删除</el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                  <div class="oneRight">
                    <span>【删除高级合伙人】</span>
                    <el-table
                      border
                      :data="companyData.delSeniorPartners"
                      v-loading="loading"
                      :header-cell-style="getRowClass"
                      height="250px"
                      empty-text="无修改"
                    >
                      <el-table-column
                        label="商城ID"
                        align="center"
                        prop="entityid"
                      > </el-table-column>
                      <el-table-column
                        label="合伙人类型"
                        align="center"
                        prop="partnertype"
                      >
                        <template slot-scope="scope">
                          <span
                            v-if="scope.row.partnertype==0"
                            style="color:#4acf1e;"
                          >孵化</span>
                          <span
                            v-else-if="scope.row.partnertype==1"
                            style="color:#4acf1e;"
                          >临时</span>
                          <span
                            v-else-if="scope.row.partnertype==2"
                            style="color:#4acf1e;"
                          >正式</span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        label="商城公司账号"
                        align="center"
                        prop="entityaccount"
                      > </el-table-column>
                      <el-table-column
                        label="商城公司名称"
                        align="center"
                        prop="entitycompanyname"
                      >
                        <template slot-scope="scope">
                          <span style="color:#4acf1e;">{{scope.row.entitycompanyname}}</span>

                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </div>
              </el-form-item>

              <el-form-item
                style="margin-top:20px"
                label="合伙人信息："
                label-width="200px"
              >
                <div class="oneInfo">
                  <div class="oneLeft">
                    <span>【新增合伙人】</span>
                    <el-table
                      border
                      :data="companyData.addPartners"
                      v-loading="loading"
                      :header-cell-style="getRowClass"
                      height="250px"
                      empty-text="无修改"
                    >
                      <el-table-column
                        label="商城ID"
                        align="center"
                        prop="entityid"
                      > </el-table-column>
                      <el-table-column
                        label="合伙人类型"
                        align="center"
                        prop="partnertype"
                      >
                        <template slot-scope="scope">
                          <span
                            v-if="scope.row.partnertype==0"
                            style="color:#4acf1e;"
                          >孵化</span>
                          <span
                            v-else-if="scope.row.partnertype==1"
                            style="color:#4acf1e;"
                          >临时</span>
                          <span
                            v-else-if="scope.row.partnertype==2"
                            style="color:#4acf1e;"
                          >正式</span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        label="商城公司账号"
                        align="center"
                        prop="entityaccount"
                      > </el-table-column>
                      <el-table-column
                        label="商城公司名称"
                        align="center"
                        prop="entitycompanyname"
                      >
                        <template slot-scope="scope">
                          <span style="color:#4acf1e;">{{scope.row.entitycompanyname}}</span>

                        </template>
                      </el-table-column>

                    </el-table>
                  </div>
                  <div class="oneRight">
                    <span>【删除合伙人】</span>
                    <el-table
                      border
                      :data="companyData.delPartners"
                      v-loading="loading"
                      :header-cell-style="getRowClass"
                      height="250px"
                      empty-text="无修改"
                    >
                      <el-table-column
                        label="商城ID"
                        align="center"
                        prop="entityid"
                      > </el-table-column>
                      <el-table-column
                        label="合伙人类型"
                        align="center"
                        prop="partnertype"
                      >
                        <template slot-scope="scope">
                          <span
                            v-if="scope.row.partnertype==0"
                            style="color:#4acf1e;"
                          >孵化</span>
                          <span
                            v-else-if="scope.row.partnertype==1"
                            style="color:#4acf1e;"
                          >临时</span>
                          <span
                            v-else-if="scope.row.partnertype==2"
                            style="color:#4acf1e;"
                          >正式</span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        label="商城公司账号"
                        align="center"
                        prop="entityaccount"
                      > </el-table-column>
                      <el-table-column
                        label="商城公司名称"
                        align="center"
                        prop="entitycompanyname"
                      >
                        <template slot-scope="scope">
                          <span style="color:#4acf1e;">{{scope.row.entitycompanyname}}</span>

                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </div>
              </el-form-item>

            </el-card>
          </el-form>
          <div style="display:flex;justify-content: center;">
            <el-button
              type="warning"
              style="margin:10px auto"
              @click="()=>{$router.go(-1)}"
            >关闭</el-button>
          </div>
        </el-card>

      </div>
    </div>

  </div>
</template>

<script>
import { getEditRecordDetail } from '../../api/handWork/handWorkList'
export default {
  data() {
    return {
      loading: false,
      data: [],
      recordid: null,
      companyData: {}, //详情信息
      companyoriginator: [],
      primevaceo: [],
      changePrimevaceo: [],
    }
  },
  created() {
    console.log(this.$route.query.recordid)
    if (this.$route.query.recordid) {
      this.recordid = this.$route.query.recordid
      this.getData()
    }
  },
  methods: {
    //设置表头颜
    getRowClass({ rowIndex }) {
      if (rowIndex == 0) {
        return 'background:RGB(238,239,246)'
      } else {
        return ''
      }
    },
    //     获取添加数据
    getData() {
      getEditRecordDetail({ recordId: this.recordid })
        .then((res) => {
          console.log(res, '编辑详情')
          if (res.code != 0) {
            this.$message.error(res.message)
            return false
          }
          this.companyData = res.data
          // 绑定创始人表格
          const data = res.data
          this.companyoriginator = [
            {
              companyoriginatorid: this.companyData.companyoriginatorid,
              originatoraccount: this.companyData.originatoraccount,
              originatorcompanyname: this.companyData.originatorcompanyname,
            },
          ]
          if (
            data.primevaceotype ||
            data.primevaceoid ||
            data.primevaceoaccount ||
            data.primevaceocompanyname
          ) {
            // 绑定首席表格
            this.primevaceo = [
              {
                primevaceotype: this.companyData.primevaceotype,
                primevaceoid: this.companyData.primevaceoid,
                primevaceoaccount: this.companyData.primevaceoaccount,
                primevaceocompanyname: this.companyData.primevaceocompanyname,
              },
            ]

            this.changePrimevaceo = [
              {
                primevaceotype: this.companyData.newceotype,
                primevaceoid: this.companyData.newceoid,
                primevaceoaccount: this.companyData.newceoaccount,
                primevaceocompanyname: this.companyData.newceocompanyname,
              },
            ]
          }
        })
        .catch(() => {})
    },
    //     获取编辑数据
    getEditData() {},
  },
}
</script>
<style scoped>
.el-form-item /deep/ .el-form-item__label {
  font-size: 16px;
}
.content {
  display: flex;
}
.cardLeft {
  width: 45%;
}
.cardRight {
  margin-left: 10%;
  width: 45%;
}

.next {
  margin: 60px auto;
  display: flex;
}
.nextLeft {
  width: 45%;
}
.nextRight {
  margin-left: 10%;
  width: 45%;
}

.foot {
  margin: 60px auto;
  display: flex;
}
.footLeft {
  width: 45%;
}
.footRight {
  margin-left: 10%;
  width: 45%;
}

.end {
  margin: 60px auto;
  display: flex;
}
.endLeft {
  width: 100%;
}
.oneInfo {
  display: flex;
}
.oneLeft {
  width: 40%;
}
.oneRight {
  margin-left: 10%;
  width: 40%;
}
</style>

